﻿using System;

namespace HandsonSoft.Web.WebFormsModelBinder
{
    [AttributeUsage(AttributeTargets.Property)]
    public class ValueSource : Attribute
    {
        public string Name { get; set; }

        public ValueSource()
        {
            Name = FromProperty.Text.ToString();
        }

        public ValueSource(string name)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException();

            Name = name;
        }

        public ValueSource(FromProperty source)
        {
            Name = source.ToString();
        }
    }
}
